package com.weasel.im.common.service.impl;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Maps;
import com.weasel.im.common.domain.IMSession;
import com.weasel.im.common.service.IMSessionDAO;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Dylan on 2015/12/1.
 */
public class DefaultIMSessionDAO implements IMSessionDAO {

    private Map<String,IMSession> sessions = new HashMap<String, IMSession>();

    public void create(IMSession session) {

        sessions.put(session.getId(),session);
    }

    public void delete(String sessionid) {

        sessions.remove(sessionid);
    }

    public IMSession get(String sessionid) {

        IMSession session = sessions.get(sessionid);
        return session;
    }

}
